//
// CTessBlock.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CPlane;
import org.ryzom.nel.misc.CVector;

public class CTessBlock {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CTessBlock(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CTessBlock obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CTessBlock(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setFar0FaceVector(SWIGTYPE_p_unsigned_int value) {
    nel3dJNI.CTessBlock_Far0FaceVector_set(swigCPtr, this, SWIGTYPE_p_unsigned_int.getCPtr(value));
  }

  public SWIGTYPE_p_unsigned_int getFar0FaceVector() {
    long cPtr = nel3dJNI.CTessBlock_Far0FaceVector_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_int(cPtr, false);
  }

  public void setFar1FaceVector(SWIGTYPE_p_unsigned_int value) {
    nel3dJNI.CTessBlock_Far1FaceVector_set(swigCPtr, this, SWIGTYPE_p_unsigned_int.getCPtr(value));
  }

  public SWIGTYPE_p_unsigned_int getFar1FaceVector() {
    long cPtr = nel3dJNI.CTessBlock_Far1FaceVector_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_int(cPtr, false);
  }

  public void setFarVertexList(SWIGTYPE_p_CTessListT_CTessFarVertex_t value) {
    nel3dJNI.CTessBlock_FarVertexList_set(swigCPtr, this, SWIGTYPE_p_CTessListT_CTessFarVertex_t.getCPtr(value));
  }

  public SWIGTYPE_p_CTessListT_CTessFarVertex_t getFarVertexList() {
    return new SWIGTYPE_p_CTessListT_CTessFarVertex_t(nel3dJNI.CTessBlock_FarVertexList_get(swigCPtr, this), true);
  }

  public void setNearVertexList(SWIGTYPE_p_CTessListT_CTessNearVertex_t value) {
    nel3dJNI.CTessBlock_NearVertexList_set(swigCPtr, this, SWIGTYPE_p_CTessListT_CTessNearVertex_t.getCPtr(value));
  }

  public SWIGTYPE_p_CTessListT_CTessNearVertex_t getNearVertexList() {
    return new SWIGTYPE_p_CTessListT_CTessNearVertex_t(nel3dJNI.CTessBlock_NearVertexList_get(swigCPtr, this), true);
  }

  public void setFarFaceList(SWIGTYPE_p_CTessListT_CTessFace_t value) {
    nel3dJNI.CTessBlock_FarFaceList_set(swigCPtr, this, SWIGTYPE_p_CTessListT_CTessFace_t.getCPtr(value));
  }

  public SWIGTYPE_p_CTessListT_CTessFace_t getFarFaceList() {
    return new SWIGTYPE_p_CTessListT_CTessFace_t(nel3dJNI.CTessBlock_FarFaceList_get(swigCPtr, this), true);
  }

  public void setRdrTileRoot(SWIGTYPE_p_p_CTileMaterial value) {
    nel3dJNI.CTessBlock_RdrTileRoot_set(swigCPtr, this, SWIGTYPE_p_p_CTileMaterial.getCPtr(value));
  }

  public SWIGTYPE_p_p_CTileMaterial getRdrTileRoot() {
    long cPtr = nel3dJNI.CTessBlock_RdrTileRoot_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_p_CTileMaterial(cPtr, false);
  }

  public void setFaceTileMaterialRefCount(long value) {
    nel3dJNI.CTessBlock_FaceTileMaterialRefCount_set(swigCPtr, this, value);
  }

  public long getFaceTileMaterialRefCount() {
    return nel3dJNI.CTessBlock_FaceTileMaterialRefCount_get(swigCPtr, this);
  }

  public void setTileMaterialRefCount(long value) {
    nel3dJNI.CTessBlock_TileMaterialRefCount_set(swigCPtr, this, value);
  }

  public long getTileMaterialRefCount() {
    return nel3dJNI.CTessBlock_TileMaterialRefCount_get(swigCPtr, this);
  }

  public void setLightMapId(long value) {
    nel3dJNI.CTessBlock_LightMapId_set(swigCPtr, this, value);
  }

  public long getLightMapId() {
    return nel3dJNI.CTessBlock_LightMapId_get(swigCPtr, this);
  }

  public void setLightMapRefCount(long value) {
    nel3dJNI.CTessBlock_LightMapRefCount_set(swigCPtr, this, value);
  }

  public long getLightMapRefCount() {
    return nel3dJNI.CTessBlock_LightMapRefCount_get(swigCPtr, this);
  }

  public void setLightMapRdrPass(CPatchRdrPass value) {
    nel3dJNI.CTessBlock_LightMapRdrPass_set(swigCPtr, this, CPatchRdrPass.getCPtr(value), value);
  }

  public CPatchRdrPass getLightMapRdrPass() {
    long cPtr = nel3dJNI.CTessBlock_LightMapRdrPass_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CPatchRdrPass(cPtr, false);
  }

  public void setVegetableBlock(CLandscapeVegetableBlock value) {
    nel3dJNI.CTessBlock_VegetableBlock_set(swigCPtr, this, CLandscapeVegetableBlock.getCPtr(value), value);
  }

  public CLandscapeVegetableBlock getVegetableBlock() {
    long cPtr = nel3dJNI.CTessBlock_VegetableBlock_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CLandscapeVegetableBlock(cPtr, false);
  }

  public CTessBlock() {
    this(nel3dJNI.new_CTessBlock(), true);
  }

  public void init(CPatch patch) {
    nel3dJNI.CTessBlock_init(swigCPtr, this, CPatch.getCPtr(patch), patch);
  }

  public CPatch getPatch() {
    long cPtr = nel3dJNI.CTessBlock_getPatch(swigCPtr, this);
    return (cPtr == 0) ? null : new CPatch(cPtr, false);
  }

  public void extendSphereFirst(CVector vec) {
    nel3dJNI.CTessBlock_extendSphereFirst(swigCPtr, this, CVector.getCPtr(vec), vec);
  }

  public void extendSphereAdd(CVector vec) {
    nel3dJNI.CTessBlock_extendSphereAdd(swigCPtr, this, CVector.getCPtr(vec), vec);
  }

  public void extendSphereCompile() {
    nel3dJNI.CTessBlock_extendSphereCompile(swigCPtr, this);
  }

  public void resetClip() {
    nel3dJNI.CTessBlock_resetClip(swigCPtr, this);
  }

  public void forceClip() {
    nel3dJNI.CTessBlock_forceClip(swigCPtr, this);
  }

  public static void setCurrentPyramid(CPlane value) {
    nel3dJNI.CTessBlock_CurrentPyramid_set(CPlane.getCPtr(value), value);
  }

  public static CPlane getCurrentPyramid() {
    long cPtr = nel3dJNI.CTessBlock_CurrentPyramid_get();
    return (cPtr == 0) ? null : new CPlane(cPtr, false);
  }

  public void clip() {
    nel3dJNI.CTessBlock_clip(swigCPtr, this);
  }

  public void clipFar(CVector refineCenter, float tileDistNear, float farTransition) {
    nel3dJNI.CTessBlock_clipFar(swigCPtr, this, CVector.getCPtr(refineCenter), refineCenter, tileDistNear, farTransition);
  }

  public boolean getClipped() {
    return nel3dJNI.CTessBlock_getClipped(swigCPtr, this);
  }

  public boolean visibleFar0() {
    return nel3dJNI.CTessBlock_visibleFar0(swigCPtr, this);
  }

  public boolean visibleTile() {
    return nel3dJNI.CTessBlock_visibleTile(swigCPtr, this);
  }

  public boolean visibleFar1() {
    return nel3dJNI.CTessBlock_visibleFar1(swigCPtr, this);
  }

  public void createFaceVectorFar0(CLandscapeFaceVectorManager mgr) {
    nel3dJNI.CTessBlock_createFaceVectorFar0(swigCPtr, this, CLandscapeFaceVectorManager.getCPtr(mgr), mgr);
  }

  public void deleteFaceVectorFar0(CLandscapeFaceVectorManager mgr) {
    nel3dJNI.CTessBlock_deleteFaceVectorFar0(swigCPtr, this, CLandscapeFaceVectorManager.getCPtr(mgr), mgr);
  }

  public void createFaceVectorFar1(CLandscapeFaceVectorManager mgr) {
    nel3dJNI.CTessBlock_createFaceVectorFar1(swigCPtr, this, CLandscapeFaceVectorManager.getCPtr(mgr), mgr);
  }

  public void deleteFaceVectorFar1(CLandscapeFaceVectorManager mgr) {
    nel3dJNI.CTessBlock_deleteFaceVectorFar1(swigCPtr, this, CLandscapeFaceVectorManager.getCPtr(mgr), mgr);
  }

  public void createFaceVectorTile(CLandscapeFaceVectorManager mgr) {
    nel3dJNI.CTessBlock_createFaceVectorTile(swigCPtr, this, CLandscapeFaceVectorManager.getCPtr(mgr), mgr);
  }

  public void deleteFaceVectorTile(CLandscapeFaceVectorManager mgr) {
    nel3dJNI.CTessBlock_deleteFaceVectorTile(swigCPtr, this, CLandscapeFaceVectorManager.getCPtr(mgr), mgr);
  }

  public void refillFaceVectorFar0() {
    nel3dJNI.CTessBlock_refillFaceVectorFar0(swigCPtr, this);
  }

  public void refillFaceVectorFar1() {
    nel3dJNI.CTessBlock_refillFaceVectorFar1(swigCPtr, this);
  }

  public void refillFaceVectorTile() {
    nel3dJNI.CTessBlock_refillFaceVectorTile(swigCPtr, this);
  }

  public boolean isInModifyList() {
    return nel3dJNI.CTessBlock_isInModifyList(swigCPtr, this);
  }

  public void appendToModifyListAndDeleteFaceVector(CTessBlock root, CLandscapeFaceVectorManager mgr) {
    nel3dJNI.CTessBlock_appendToModifyListAndDeleteFaceVector(swigCPtr, this, CTessBlock.getCPtr(root), root, CLandscapeFaceVectorManager.getCPtr(mgr), mgr);
  }

  public void removeFromModifyList() {
    nel3dJNI.CTessBlock_removeFromModifyList(swigCPtr, this);
  }

  public CTessBlock getNextToModify() {
    long cPtr = nel3dJNI.CTessBlock_getNextToModify(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessBlock(cPtr, false);
  }

}
